/*
*Copyright (c) Nikhil Jain.
*Project ICARUS, communications and 
*artificial intelligence.
*/



/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
 */
package javadrone.server;

//~--- non-JDK imports --------------------------------------------------------

import javadrone.Drone;
import javadrone.Sensor;
import javadrone.SensoryData;

/**
 *
 * @author Nikzzay
 * Install in server only.
 */
public class StateChangeEvent<T extends SensoryData> {
    private Drone       drone;
    private SensoryData oldState, newState;

    public StateChangeEvent(T oldState, T newState, Drone drone) {
        this.oldState = oldState;
        this.newState = newState;
        this.drone    = drone;
    }

    public SensoryData getPreviousState() {
        return oldState;
    }

    public SensoryData getCurrentState() {
        return newState;
    }

    public Drone getDrone() {
        return drone;
    }

    public Sensor getDescriptor() {
        return oldState.getDescriptor();
    }

    @Override
    public String toString() {
        return getDescriptor().toString() + ": " + newState;
    }
}


//~ Formatted by Jindent --- http://www.jindent.com
